import { View } from "../../../mvc/core/View";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { FontUtil } from "../../../common/font/FontUtil";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { ImagesConst } from "../../resource/ImagesConst";
import { Cache } from "../../cache/Cache";
type int = number;
//class GuildIncome
    
    export  class GuildIncome extends View
    {
        constructor()
        {
            super();
            this.coinTextFeildList = [];
            this.goldTextFeildList = [];
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            var loc1=GlobalStyle.textFormat9;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            var loc2=GlobalStyle.textFormat1;
            loc2.align = flash.text.TextFormatAlign.RIGHT;
            var loc3=GlobalStyle.getTextFormatCenter(GlobalStyle.textFormat6);
            loc3.font = FontUtil.lishuName;
            loc3.size = 18;
            loc3.letterSpacing = 2;
            ObjCreate.createTextField(Language.getString(85093), 157, 64, 140, 20, this, loc3, false, false);
            ObjCreate.createBg(19, 90, 391, 32, this, ImagesConst.DisabledBg);
            ObjCreate.createTextField(Language.getString(85089), 125, 97, 60, 17, this, GlobalStyle.textFormat2, false, false);
            ObjCreate.createTextField(Language.getString(85090), 265, 97, 60, 17, this, GlobalStyle.textFormat2, false, false);
            this.createItem(120, 0, "", loc1, loc2, false);
            ObjCreate.createBitmap(ImagesConst.ChatGuildMember_star, 32, 130, this);
            ObjCreate.createBg(18, 158, 395, 26, this, ImagesConst.RbListHeader);
            ObjCreate.createBg(18, 188, 390, 1, this, ImagesConst.SplitLine);
            ObjCreate.createTextField(Language.getString(85091), 157, 164, 140, 20, this, loc3, false, false);
            ObjCreate.createBg(19, 191, 391, 32, this, ImagesConst.DisabledBg);
            ObjCreate.createTextField(Language.getString(85089), 125, 199, 60, 17, this, GlobalStyle.textFormat2, false, false);
            ObjCreate.createTextField(Language.getString(85090), 265, 199, 60, 17, this, GlobalStyle.textFormat2, false, false);
            this.createItem(224 + 0 * 36, 1, "", loc1, loc2, true);
            var loc4;
            (loc4 = ObjCreate.createTextField(Language.getString(85088), 30, 277, 378, 70, this, null, true, false)).autoSize = flash.text.TextFieldAutoSize.LEFT;
            var loc5;
            loc4.wordWrap = loc5 = true;
            loc4.multiline = loc5;
            return;
        }

        /* internal  */createItem(arg1: int, arg2: int, arg3: string, arg4: Object /* flash.text.TextFormat */, arg5: Object /* flash.text.TextFormat */, arg6: Boolean): void
        {
            if (arg6) 
            {
                ObjCreate.createBg(0, arg1 + 36, 392, 1, this, ImagesConst.KillUserLine);
            }
            this.coinTextFeildList[arg2] = ObjCreate.createTextField("", 80, arg1 + 13, 80, 17, this, arg5, false, false);
            this.goldTextFeildList[arg2] = ObjCreate.createTextField("", 215, arg1 + 13, 80, 17, this, arg5, false, false);
            ObjCreate.createBitmap(ImagesConst.Tongqian_small, 158, arg1 + 14, this);
            ObjCreate.createBitmap(ImagesConst.Yuanbao_small, 295, arg1 + 12, this);
            return;
        }

        public updateData(): void
        {
            var loc1=Cache.instance.crossCityIncome;
            var loc2=loc1.getIsDoubleWeek();
            var loc3=loc1.thisTotalCoinIncome;
            var loc4=loc1.thisTotalGoldIncome;
            if (loc2) 
            {
                loc3 = loc3 + loc1.preTotalCoinIncome;
                loc4 = loc4 + loc1.preTotalGoldIncome;
            }
            this.updateTextFeildValue(0, 0.05, loc3, loc4);
            this.updateTextFeildValue(1, 0.03, loc3, loc4);
            return;
        }

        /* internal  */updateTextFeildValue(arg1: int, arg2: number, arg3: number, arg4: number): void
        {
            var loc1=null;
            var loc2=null;
            loc1 = this.coinTextFeildList[arg1];
            loc2 = this.goldTextFeildList[arg1];
            loc1.text = this.formatFun(arg3 * arg2, 4);
            loc2.text = this.formatFun(arg4 * arg2, 1);
            return;
        }

        /* internal  */formatFun(arg1: int, arg2: int): string
        {
            var loc1=String(arg1);
            var loc2=Math.pow(10, arg2);
            loc2 = int(arg1 / loc2) * loc2;
            return String(loc2);
        }

        /* internal */ /* var */coinTextFeildList: Array<any>;

        /* internal */ /* var */goldTextFeildList: Array<any>;
    }
